#ifndef __UC1701_H
#define __UC1701_H

#include "stm32f10x.h"
#include "BAT_Cal.h"

#define H                   1
#define L                   0

#define UC1701_RSTB_PORT    GPIOA
#define UC1701_RSTB_PIN     GPIO_Pin_6

#define UC1701_SDI_PORT     GPIOC
#define UC1701_SDI_PIN      GPIO_Pin_5

#define UC1701_SCL_PORT     GPIOC
#define UC1701_SCL_PIN      GPIO_Pin_4

#define UC1701_CS_PORT      GPIOA
#define UC1701_CS_PIN       GPIO_Pin_5

#define UC1701_RS_PORT      GPIOA
#define UC1701_RS_PIN       GPIO_Pin_7


#define UC1701_RSTB(x)      (x !=0)?GPIO_SetBits(UC1701_RSTB_PORT, UC1701_RSTB_PIN) :GPIO_ResetBits(UC1701_RSTB_PORT, UC1701_RSTB_PIN)
#define UC1701_SDI(x)       (x !=0)?GPIO_SetBits(UC1701_SDI_PORT,  UC1701_SDI_PIN)  :GPIO_ResetBits(UC1701_SDI_PORT,  UC1701_SDI_PIN)
#define UC1701_SCL(x)       (x !=0)?GPIO_SetBits(UC1701_SCL_PORT,  UC1701_SCL_PIN)  :GPIO_ResetBits(UC1701_SCL_PORT,  UC1701_SCL_PIN)
#define UC1701_CS(x)        (x !=0)?GPIO_SetBits(UC1701_CS_PORT,   UC1701_CS_PIN)   :GPIO_ResetBits(UC1701_CS_PORT,   UC1701_CS_PIN)
#define UC1701_RS(x)        (x !=0)?GPIO_SetBits(UC1701_RS_PORT,   UC1701_RS_PIN)   :GPIO_ResetBits(UC1701_RS_PORT,   UC1701_RS_PIN)

void Init_uc1701(void);
void Write_uc1701_COM(u8 COMDADA_4SPI);
void Write_uc1701_DISPLAY_DATA_serial_4SPI(u8 DADA_4SPI);
void Delay_1ms(unsigned long value);
void HDReset(void);
void clearFullScreen(void);
void Display_line(void);
void ScreenInital(void);
void showContent(void);
void updateScreen(void);

#endif
